import { reactive } from 'vue'
import { ViewDef } from './ViewDef'

export class FormView {
  viewDef: ViewDef
  formData: any

  constructor(viewDef: ViewDef, newData: any = {}) {
    this.viewDef = viewDef
    this.formData = reactive(newData)
  }
  reloadFormData(newData: any) {
    for (let name in newData) {
      //* 一个一个填充值是为了让他走reactive能够有响应式效果
      this.formData[name] = newData[name]
    }
  }
  save() {}
}
